package br.com.simora.musica;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="musica")
public class Musica implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -926821864023851718L;

	@Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="id")
    private Integer id;
	
	@Column(name="nome")
	private String nome;
	
	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="artista_id")
	private Artista artista;
	
	private transient String idfp;
	
	private transient Long total;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		if(null != nome && !"".equals(nome)){
			this.nome = nome.toLowerCase();
		}
	}

	public Artista getArtista() {
		return artista;
	}

	public void setArtista(Artista artista) {
		this.artista = artista;
	}
	public Long getTotal() {
		return total;
	}

	public void setTotal(Long total) {
		this.total = total;
	}

	public String getIdfp() {
		return idfp;
	}

	public void setIdfp(String idfp) {
		this.idfp = idfp;
	}
	
}